<?php

namespace common\models\user;

use Yii;

/**
 * This is the model class for table "{{%user_withdraw_account}}".
 *
 * @property int $id
 * @property int $user_id 用户ID
 * @property int $type 类型【1支付宝、2银行】
 * @property string $card_no 账号
 * @property string $name 姓名
 * @property string $bank_name 银行【type=2存在】
 * @property int $created_at 创建时间
 * @property int $updated_at 更新时间
 */
class UserWithdrawAccount extends \common\models\base\BaseModel
{
    const TYPE_ALIPAY = 1;
    const TYPE_BANK = 2;

    public static $types = [
        self::TYPE_ALIPAY => '支付宝',
        self::TYPE_BANK => '银行',
    ];

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%user_withdraw_account}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['user_id', 'type', 'created_at', 'updated_at'], 'integer'],
            [['card_no', 'name', 'bank_name'], 'string', 'max' => 32],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'user_id' => '用户ID',
            'type' => '类型【1支付宝、2银行】',
            'card_no' => '账号',
            'name' => '姓名',
            'bank_name' => '银行【type=2存在】',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
        ];
    }
}
